package com.example.back.mapper;

import com.example.back.entity.Book;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


import java.util.List;

@Mapper
public interface BookMapper {
    @Select("<script>" +
            "select * from t_book " +
            "<where>" +
            "<if test=\"name != null and name != ''\">" +
            "<bind name=\"pattern\" value=\"'%' + _parameter + '%'\"/>" +
            "name like #{pattern}" +
            "</if>" +
            "</where>" +
            "</script>")

    List<Book> findAll(String name);
}
